package com.cq.hd.merchant.controller;

import com.cq.hd.common.annotation.MerchantLoginUser;
import com.cq.hd.common.entity.MerchantAppLoginUser;
import com.cq.hd.common.response.Result;
import com.cq.hd.common.response.ResultGenerator;
import com.cq.hd.merchant.biz.IndexBiz;
import com.cq.hd.merchant.vo.MerchantIndexVo;
import com.cq.hd.merchant.vo.MyPageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

@RestController
@RequestMapping("/index")
@Api(tags = "首页相关接口")
public class IndexController {

    @Autowired
    private IndexBiz indexBiz;

    @ApiOperation(value = "商户首页统计数据")
    @ApiResponse(response = MerchantIndexVo.class, code = 200, message = "接口返回对象参数")
    @GetMapping("/statistics")
    public Result<MerchantIndexVo> statistics(@ApiIgnore @MerchantLoginUser MerchantAppLoginUser merchantAppLoginUser) {
        return ResultGenerator.success(indexBiz.statistics(merchantAppLoginUser));
    }

    @ApiOperation(value = "我的页面数据")
    @ApiResponse(response = MyPageVo.class, code = 200, message = "接口返回对象参数")
    @GetMapping("/myPage")
    public Result<MyPageVo> myPage(@ApiIgnore @MerchantLoginUser MerchantAppLoginUser merchantAppLoginUser) {
        return ResultGenerator.success(indexBiz.myPage(merchantAppLoginUser));
    }

}
